home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d18 / intrfc55.arc / PARAMS.PAS < prev    next >
Pascal/Delphi Source File  |  1990-02-25  |  3KB  |  94 lines

  1. unit params;
  2. interface
  3.   uses globals,util;
  4.  
  5.   procedure syntax_exit(msg:string);
  6.   procedure parse_params;
  7.  
  8. implementation
  9.  
  10. procedure syntax_exit(msg:string);
  11. begin
  12.   writeln(msg);
  13.   writeln('Syntax:');
  14.   writeln('INTRFC /options unit');
  15.   writeln('where options are letters from the following:');
  16.   writeln('B - emitted code bytes');
  17.   writeln('C - initialized constant blocks');
  18.   writeln('D - code blocks');
  19.   writeln('E - routine entry records');
  20.   writeln('G - emitted global const bytes');
  21.   writeln('H - TPU header');
  22.   writeln('I - implementation section (if $D was used in compilation)');
  23.   writeln('L - proc/fn locals (if $L was used in compilation)');
  24.   writeln('N - names in interface');
  25.   writeln('O - object VMT records');
  26.   writeln('R - relocation records');
  27.   writeln('V - var blocks');
  28.   writeln('A - turn all options on');
  29.   writeln('Options are processed sequentially and toggle the display.');
  30.   writeln('Use /Tpath to set the Turbo directory for TURBO.TPL and referenced');
  31.   writeln(' units.');
  32.   writeln('E.G. To see all but the relocation records in the system unit, use');
  33.   writeln('   INTRFC /AR /T\turbo SYSTEM ');
  34.   writeln('The default is just the names in the interface section.');
  35.   halt(1);
  36. end;
  37.  
  38. procedure toggle(o:option);
  39. begin
  40.   if o in active_options then
  41.     active_options := active_options - [o]
  42.   else
  43.     active_options := active_options + [o];
  44. end;
  45.  
  46. procedure parse_params;
  47. var
  48.   p : string;
  49.   i : integer;
  50. begin
  51.   i := 1;
  52.   unitname := '';
  53.   uses_path := '';
  54.   for i := 1 to paramcount do
  55.   begin
  56.     p := paramstr(i);
  57.     if p[1] <> '/' then
  58.       unitname := upper(p)
  59.     else
  60.     begin
  61.       p := copy(p,2,255);   { strip off the / }
  62.       while length(p) > 0 do
  63.       begin
  64.         case upcase(p[1]) of
  65.         'H' : toggle(do_header);
  66.         'N' : toggle(do_name_list);
  67.         'I' : toggle(do_implementation);
  68.         'E' : toggle(do_entry_pts);
  69.         'D' : toggle(do_code_blocks);
  70.         'C' : toggle(do_const_blocks);
  71.         'V' : toggle(do_var_blocks);
  72.         'U' : toggle(do_unit_blocks);
  73.         'B' : toggle(do_code);
  74.         'G' : toggle(do_const);
  75.         'R' : toggle(do_reloc);
  76.         'O' : toggle(do_vmt);
  77.         'L' : toggle(do_locals);
  78.         'A' : active_options := [do_header..do_locals];
  79.         'T' : begin
  80.                 uses_path := copy(p,2,255);
  81.                 if uses_path[length(uses_path)] <> '\' then
  82.                   uses_path := uses_path + '\';
  83.                 p := '';
  84.               end;
  85.         else
  86.           syntax_exit('Unrecognized option '+paramstr(i)+'.');
  87.         end;
  88.         p := copy(p,2,255);
  89.       end;
  90.     end;
  91.   end;
  92. end;
  93.  
  94. end.